
interface Iparams {
    methods: string,
    url: string,
    data?: string
}

function js_ajax(params: Iparams) {
    let xhr = new XMLHttpRequest();
    xhr.open(params.methods, params.url, true);
    xhr.send(params.data);
    xhr.onload = function () {
        if (xhr.readyState == 4 && xhr.status == 200) {
            console.log(xhr.responseText);

        }
    }
}
js_ajax({
    methods: "get",
    url: ""
})

